<?php
namespace app\common\taglib;

use think\template\TagLib;

class Mier extends TagLib
{

    /**
     * 定义标签列表
     */
    protected $tags = [

        'add_one' => [
            'attr' => 'event',
            'close' => 0,
        ],
        'add_all' => [
            'attr' => 'event',
            'close' => 0,
        ],
        'images' => [
            'attr' => 'id,name,style,width,height,type,value',
            'close' => 0,
        ],
    ];
    public function tagAddOne($tag)
    {
        $event = !empty($tag['event']) ? $tag['event'] : 'tab';
        $parse = <<<EOF
        <a href="#" mier-event="{$event}" data-url="{:url('add')}" data-title="添加" data-icon="layui-icon layui-icon-add1" class="mier-btn"><i class="layui-icon layui-icon-edit"></i>添加</a>'
        EOF;
        return $parse;
    }
    public function tagAddAll($tag)
    {
        $event = !empty($tag['event']) ? $tag['event'] : 'tab';
        $parse = <<<EOF
        <a href="#" data-icon="layui-icon layui-icon-add1" class="mier-btn"><i class="layui-icon layui-icon-edit"></i>添加</a>'
        <ul class="submenu layui-anim layui-anim-upbit">
            <div class="submenu-row">
                <li class="mier-column"><a href="#" [field] mier-event="info" data-url="{:url('add')}" data-icon="layui-icon layui-icon-add1" class="mier-btn">弹窗添加</a></li>
                <li class="mier-column"><a href="#" [field] mier-event="info" data-url="{:url('add')}" data-icon="layui-icon layui-icon-add1" data-full="true" class="mier-btn">全屏添加</a></li>
                <li class="mier-column" [style]><a href="#" [field] mier-event="tab" data-url="{:url('add')}" data-title="添加" data-icon="layui-icon layui-icon-add1" class="mier-btn">添加</a></li>
            </div>
        </ul>
        EOF;
        return $parse;
    }
}
